package StratelegoGame;
import java.awt.Color;
import java.io.IOException;

/**
 * Create pieces game pieces or a piece based on a piece value.
 * @author Jace Ferguson
 * @filename GameBoard2DPieceFactory.java
 *
 */
public class GameBoard2DPieceFactory {
	/**
	 * Create a piece based on the send value. 
	 * @param value	int piece value
	 * @param imageFile	String file name for tile image
	 * @param color	Color color for background if not file is sent
	 * @param type	Integer	friend or foe
	 * @return	createPieceWithValue
	 * @throws IOException	
	 */
	public static GameBoard2DPiece createPieceWithValue(Integer value, String imageFile, Color color, Integer type) throws IOException
	{
		switch(value)
		{
		case 1: return GameBoard2DPieceFactory.createBombPiece(imageFile, color, type);
		case 2: return GameBoard2DPieceFactory.createScoutPiece(imageFile, color, type);
		case 3: return GameBoard2DPieceFactory.createMinerPiece(imageFile, color, type);
		case 4: return GameBoard2DPieceFactory.createSergeantPiece(imageFile, color, type);
		case 5: return GameBoard2DPieceFactory.createLieutenantPiece(imageFile, color, type);
		case 6: return GameBoard2DPieceFactory.createCaptainPiece(imageFile, color, type);
		case 7: return GameBoard2DPieceFactory.createMajorPiece(imageFile, color, type);
		case 8: return GameBoard2DPieceFactory.createColonelPiece(imageFile, color, type);
		case 9: return GameBoard2DPieceFactory.createGeneralPiece(imageFile, color, type);
		case 10: return GameBoard2DPieceFactory.createMarshalPiece(imageFile, color, type);
		case 11: return GameBoard2DPieceFactory.createSpyPiece(imageFile, color, type);
		case 12: return GameBoard2DPieceFactory.createFlagPiece(imageFile, color, type);
		default: return null;
		}
	}
	/**
	 * Create a marshal piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createMarshalPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new MarshalPiece(imageFile, color, type);
	}

	/**
	 * Create a general piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createGeneralPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new GeneralPiece(imageFile, color, type);
	}

	/**
	 * Create a colonel piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createColonelPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new ColonelPiece(imageFile, color, type);
	}

	/**
	 * Create a major piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createMajorPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new MajorPiece(imageFile, color, type);
	}

	/**
	 * Create a captain piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createCaptainPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new CaptainPiece(imageFile, color, type);
	}

	/**
	 * Create a lieutenant piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createLieutenantPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new LieutenantPiece(imageFile, color, type);
	}
	
	/**
	 * Create a sergeant piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createSergeantPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new SergeantPiece(imageFile, color, type);
	}
	
	/**
	 * Create a miner piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createMinerPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new MinerPiece(imageFile, color, type);
	}
	
	/**
	 * Create a scout piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createScoutPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new ScoutPiece(imageFile, color, type);
	}
	
	/**
	 * Create a spy piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createSpyPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new SpyPiece(imageFile, color, type);
	}
	
	/**
	 * Create a bomb piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createBombPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new BombPiece(imageFile, color, type);
	}
	
	/**
	 * Create a flag piece based on passed in parameters
	 * @param imageFile	String image file location for custom tile
	 * @param color	Color color for piece when no image is used
	 * @param type	int	Friend or Foe
	 * @return	GameBoard2DPiece	constructed piece
	 * @throws IOException
	 */
	public static GameBoard2DPiece createFlagPiece(String imageFile, Color color, Integer type) throws IOException
	{
		return new FlagPiece(imageFile, color, type);
	}
}


